<?php
// 本类由系统自动生成，仅供测试用途
namespace Admin\Controller;
use Think\Controller;
class GoodController extends baseActionController {
    public function index(){
    	$this->display();
    }
    
    
    public function feng(){
    	$info=M("fen")->where('evel=1')->select();
    	$data=M("fen")->where('evel=2')->select();
    	
    	
    	
    	$this->assign('info',$info);// 赋值分页输出
    	$this->assign('data',$data);// 赋值分页输出
    	
    	$this->display();
    }
    
    //产品添加
    public function fenadd(){
    	
    	$info=M("fen")->where('evel=1')->select();
    	$data=M("fen")->where('evel=2')->select();
    	 
    	 
    	 
    	$this->assign('info',$info);// 赋值分页输出
    	$this->assign('data',$data);// 赋值分页输出
    	$this->display();
    }
    //产品分类删除
    public function fendel(){
    	 
    $dsa=M('fen')->delete($_GET['id']);
    if ($dsa) {
    	$this->success('删除成功',U('feng'));
    }else{
    	$this->error('删除失败',U('feng'));
    }
    
    }
    //产品分类修改
    public function fenedit(){
    	
    	$info=M("fen")->where('evel=1')->select();
    	$data=M("fen")->where('evel=2')->select();
    	$dsa=M('fen')->find($_GET['id']);
    	 
    	 $a=$_GET['id'];
    
    
    	$this->assign('a',$a);// 赋值分页输出
    	$this->assign('dsa',$dsa);// 赋值分页输出
    	$this->assign('info',$info);// 赋值分页输出
    	$this->assign('data',$data);// 赋值分页输出
    	
    	$this->display();
    
    
    }
    //添加
    public function doxadd(){
    	 if ($_POST['fid']==0) {
    	 	$_POST['evel']=1;
    	 }else{
    	 	$_POST['evel']=2;
    	 }
    	$ast= M('fen')->add($_POST);
    	if ($ast) {
    $this->success('添加成功',U('feng'));
    	}else{
      	$this->error('添加失败',U('feng'));
    	}

    }
    //添加
    public function doedit(){
    	$ast= M('fen')->save($_POST);
    	if ($ast) {
    		$this->success('修改成功',U('feng'));
    	}else{
    		$this->error('修改失败',U('feng'));
    	}
     
    }
  
}